package org.sy.lab.Java7并发编程实战.七定制并发类.九实现基于优先级的传输队列;

public class Consumer implements Runnable {
	private MyPriorityTransferQueue<Event> buffer;
	public Consumer(MyPriorityTransferQueue<Event> buffer) {
		this.buffer = buffer;
	}
	@Override
	public void run() {
		for(int i=0; i<1002; i++) {
			try {
				Event value = buffer.take();
				System.out.printf("Consumer: %s %d\n", value.getThread(), value.getPriority());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
